package com.xlh.enums.courseTest;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * @author zhr 2019/1/18
 */
@Getter
@AllArgsConstructor
public enum QuestionBusinessTypeEnum {
    TEST(1, "考试"),
    PRACTICE(2, "随堂练习");

    private final Integer code;
    private final String message;

    private static Map<Integer, QuestionBusinessTypeEnum> codeMap = Maps.newHashMap();

    static {
        for (QuestionBusinessTypeEnum en : QuestionBusinessTypeEnum.values()){
            codeMap.put(en.getCode(), en);
        }
    }

    public static QuestionBusinessTypeEnum forCode(Integer code) {
        return codeMap.get(code);
    }
}
